<?php

namespace pmvc\ioc;

use pmvc\Properties;

/**
 * ObjectFactory
 *
 */
interface ObjectFactory {

	/**
	 * Gets objects from the factory of the given type.  This method
	 * works for retrieving lazy and non-lazy loaded objects.
	 * @param string $type the type name
	 */
	function getObjectsOfType($type);

	/**
	 * Gets an object from the factory by it's id.  This method
	 * works for retrieving lazy and non-lazy loaded objects.
	 * @param string $id the objects id
	 */
	function getObjectById($id);

	/**
	 * Gets an object from the factory by it's name.  This method
	 * works for retrieving lazy and non-lazy loaded objects.
	 * @param string $id the objects id
	 */
	function getObjectByName($id);

	/**
	 * Returns all of the obect ids in this {@link ObjectFactory}.
	 * @return an array of object ids
	 */
	function getObjectIds();

	/**
	 * Returns all of the obect names in this {@link ObjectFactory}.
	 * @return an array of object names
	 */
	function getObjectNames();

	/**
	 * Returns all of the obect ids in this {@link ObjectFactory}
	 * that are of the given type.
	 * @return an array of object ids
	 */
	function getObjectIdsOfType($type);

	/**
	 * Returns all of the obect names in this {@link ObjectFactory}
	 * that are of the given type.
	 * @return an array of object names
	 */
	function getObjectNamesOfType($type);

	/**
	 * Adds an {@link ObjectDescriptor} to the {@link ObjectFactory}.
	 * @param ObjectDescriptor $desc the {@link ObjectDescriptor} to add.
	 */
	function addObjectDescriptor(ObjectDescriptor $desc);

	/**
	 * Checks to see if the {@link ObjectFactory} has an object
	 * with the given name.
	 * @param string $name the object's name
	 * @param bool $recurse - whether or not to recurse to parent {@link ObjectFactory}.
	 */
	function hasObjectWithName($name, $recurse=true);

	/**
	 * Checks to see if the {@link ObjectFactory} has an object
	 * with the given id.
	 * @param string $name the object's name
	 * @param bool $recurse - whether or not to recurse to parent {@link ObjectFactory}.
	 */
	function hasObjectWithId($name, $recurse=true);
	
}

?>